﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/**
 * 类型膨胀： 一千种商品就要相应准备一千种盒子
 */
namespace BiliBiliCSharpStudy.ch30.d01 {
    class HelloGeneric1 {
        public static void Demo() {
            Test1();
        }
        public static void Test1() {
            Apple apple = new Apple() { Color = "Red" };
            AppleBox box = new AppleBox() { Cargo = apple };
            Console.WriteLine(box.Cargo.Color);
            Book book = new Book() { Name = "笑傲江湖" };
            BookBox bookBox = new BookBox() { Cargo = book };
            Console.WriteLine(bookBox.Cargo.Name);
        }
    }

    class Apple {
        public string Color { get; set; }
    }

    class Book {
        public string Name { get; set; }
    }

    class AppleBox {
        public Apple Cargo { get; set; }
    }

    class BookBox {
        public Book Cargo { get; set; }
    }
}
